import type { App } from 'vue'
import Directives from './directive'
import Global from './global'
import baseMixin from './mixin'
import shareMixin from './mixin/share'

export default function registerVueTools(app: App<Element>) {
  app.mixin(baseMixin)
  app.mixin(shareMixin)
  // 过滤器vue3废弃，改用全局方法hack
  if (app.config.globalProperties.G) {
    app.config.globalProperties.G = {
      ...app.config.globalProperties.G,
      ...Global
    }
  }
  else {
    app.config.globalProperties.G = Global
  }
  app.use(Directives)
}
